package com.tust.app.dao;


import com.tust.app.domain.Answer;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public interface AnswerMapper {


    @Select("select * from t_answer ")
     List<Answer> findAllAnswers();

    @Select("select * from t_answer where id = #{id}")
    public Answer findById(int id) ;

    @Insert("insert into t_answer (id, answeruser, content, pubtime2,topicId) values (#{id}, #{answeruser}, #{content}, #{pubtime2},#{topicId})")
     void save(Answer answer);


    @Delete("delete from t_answer where id = #{id}")
    public void deleteById(int id);

    @Update("update t_answer set state2 = #{state2} where id = #{id}")
    void update(@Param("state2") int state2, @Param("id") int id);
}
